package com.fz.study.project.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum GenderEnum {
    man(0,"男"),
    woman(1,"女");
    private final Integer code;
    private final String text;
    public static Optional<GenderEnum> getEnumGender(Integer code){
        return Arrays.stream(values()).filter(e -> Objects.equals(e.code,code)).findFirst();
    }

}
